using System;
using UnityEngine;
using UnityEngine.UI;

namespace Galplay {
  public class ImageSlot : MonoBehaviour {
    public Image image;
    public int index;

    public bool IsFlash { get; private set; }
    public float FlashTime { get; private set; }

    // Start is called once before the first execution of Update after the MonoBehaviour is created
    void Start() {

    }

    // Update is called once per frame
    void Update() {

    }

    void FixedUpdate(){
      if (IsFlash){
        FlashTime -= Time.fixedDeltaTime;
        if (FlashTime < 0){
          Hide();
          IsFlash = false;
        }
      }
    }


    public void SetFlash(float time){
      IsFlash = true;
      FlashTime = time;
    }

    internal void Show() {
      gameObject.SetActive(true);
    }
    internal void Hide(){
      gameObject.SetActive(false);
    }
  }
}